package com.eptok.gw.szcups.pojo;

import org.dom4j.Document;
import org.dom4j.Element;

import ys8583.parse.IOMessage;


/**
 *@author:heqishan, Email:heqishan@gmail.com
 *2013-3-18 下午07:29:18
 */
public class Reversal extends XmlMessage{
	
	private String oldReqSerialNumber;  //原交易流水号
	private String reqType;             //00 消费冲正 01消费撤销冲正 02信用卡还款冲正 03代收冲正 04建立委托关系 05撤销委托关系
	//////////////////////////////////
	private CupsResult cupsResult;
	
	
	public String getOldReqSerialNumber() {
		return oldReqSerialNumber;
	}
	public void setOldReqSerialNumber(String oldReqSerialNumber) {
		this.oldReqSerialNumber = oldReqSerialNumber;
	}
	public String getReqType() {
		return reqType;
	}
	public void setReqType(String reqType) {
		this.reqType = reqType;
	}
	public String getRspSerialNumber() {
		return rspSerialNumber;
	}
	public void setRspSerialNumber(String rspSerialNumber) {
		this.rspSerialNumber = rspSerialNumber;
	}
	public CupsResult getCupsResult() {
		return cupsResult;
	}
	public void setCupsResult(CupsResult cupsResult) {
		this.cupsResult = cupsResult;
	}
	@Override
	protected void decodeBody(Document document) throws Exception {
		reqSerialNumber = ((Element) document.selectObject("/szcups/body/ReqSerialNumber")).getTextTrim();
		oldReqSerialNumber = (((Element) document.selectObject("/szcups/body/OldReqSerialNumber")).getTextTrim());
	}
	@Override
	protected String encodeBody(IOMessage iomessage) throws Exception {
		StringBuffer sb = new StringBuffer();
		sb.append("<body>");
		sb.append("<ReqSerialNumber>").append(reqSerialNumber).append("</ReqSerialNumber>");
		sb.append("<OldReqSerialNumber>").append(oldReqSerialNumber).append("</OldReqSerialNumber>");
		sb.append("<ReqType>").append(reqType).append("</ReqType>");
		sb.append("<RspSerialNumber>").append(rspSerialNumber).append("</RspSerialNumber>");
		sb.append(encodeCupsResult(iomessage));
		sb.append("</body>");
		return sb.toString();
	}
	
	
}
